<!DOCTYPE html>
<html>
{block name="css"}
	<head>
		<meta charset="utf-8" />
		<title>赠送票</title>
		<link rel="stylesheet" href="/public/oem/css/iconfont.css" />
		<link rel="stylesheet" href="/public/oem/css/css.css" />
		<link rel="stylesheet" href="/public/static/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="/public/static/css/font-awesome.min.css">

		<link rel="stylesheet" href="/public/static/css/admin.css">
	</head>
{/block}

	<body>		

		<form class="layui-form layui-form-pane" method="post">
			<input type="text"  value="{$data.id}" id="id" style="display: none;">
			<div class="layui-inline" style="padding-top: 10px;padding-left: 20px;">
				<label class="layui-form-label">赠送数量</label>
				<div class="layui-input-inline">
					<input type="text" name="give_num" id='give_num' value="{$data.givenum}" placeholder="请输入数量" class="layui-input">
				</div>
			</div>
		  	<div class="layui-form-item" style="padding-top: 10px;">
			    <div class="layui-input-block">
			      <button class="layui-btn" id='tijiao' button lay-submit lay-filter="*">提交</button>
			      <button type="reset"  class="layui-btn layui-btn-primary">重置</button>
			    </div>
		  	</div>
		</form>
		
	</body>
</html>
{block name="js"}
<script type="text/javascript" src="/public/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/static/layui/layui.all.js"></script>
<script type="text/javascript" src="/public/static/js/jquery.qrcode.js"></script>
<script type="text/javascript" src="/public/static/js/utf.js"></script>
<script type="text/javascript" src="/public/static/js/zepto-1.1.6.min.js"></script>
<script type="text/javascript" src="/public/static/js/jquery.form.js"></script>
<script type="text/javascript">
		$('#tijiao').click(function() {
			$.ajax({
				type: 'post',
				data: {
					id				: $('#id').val(),
					give_num		: $('#give_num').val()					
				},
				url: "{:url('agent/givechange')}",
				success: function(data) {
					if(data.code == 200) {
						layer.msg(data.msg);
						window.parent.location.reload();
					} else {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						});
					}

				},
				error: function(XmlHttpRequest, textStatus, errorThrown) {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
				}
			});
		});
	</script>
{/block}
